package com.zl.Sqlite.db;

import android.test.AndroidTestCase;
import com.zl.Sqlite.DBheloper;

/**
 * User: c3t
 * Date: 14-5-1
 * Time: 下午4:00
 */
public class TestDbApi extends AndroidTestCase {




    public void testAdd() throws Exception {

        UserDaoApi userDaoApi = new UserDaoApi(getContext());
        userDaoApi.add("jck");
    }


    public void testFind() throws Exception {
        UserDaoApi userDaoApi = new UserDaoApi(getContext());
        assertEquals(true,userDaoApi.find("jack"));
    }

    public void testFindAll() throws Exception {
        UserDaoApi userDaoApi = new UserDaoApi(getContext());
        for(User u : userDaoApi.findAll()) {

            System.out.println(u.getName());
        }
    }

    public void testUpdate() throws Exception {

        UserDaoApi userDaoApi = new UserDaoApi(getContext());
        userDaoApi.update("wangwu", "2");
        System.out.println(userDaoApi.findAll().get(0).getName());
    }

    public void testDelete() throws Exception{

        UserDaoApi userDaoApi = new UserDaoApi(getContext());
        userDaoApi.delete("2");
        assertEquals(false, userDaoApi.find("wangwu"));
    }
}
